Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

review: Fix NPE with union catch inside lambda in noclasspath #1416

Merged
merged 5 commits into from
Jun 23, 2017

Conversation

surli
Copy link
Collaborator

@surli surli commented Jun 23, 2017

This PR fix a NPE we had when spooning a catch with multi exception inside a lambda in no classpath mode, as explained in #1415.
However the bug is not completely solved in that PR, in that sense that the model is not exactly the same as if the try catch was outside the lambda. I decided to concentrate on getting information from multi types (which was causing the NPE). But to complete it, we should also compute the type of CtCatchVariable from the multitypes (it's normally done by JDT). I opened an issue for that and I propose to solve it in a separate PR (see #1420)

@Test
public void testUnionCatchExceptionInsideLambdaInNoClasspath() {
// contract: the model should be built when defining a union catch inside a lambda which is not known (noclasspath)
// and the catch variable should be the same than outside a lambda
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this contract which seems reasonable, but I have problem to achieve this second part of the contract (and so, the last equals is a wrong assertion): JDT does not provide any information about the exception type inside the lambda, even not the fully qualified name of the exception. As a result, I have only the simple name of the class, which does not allow me easily to infer any information like on any other case.

So, do you have any idea how to improve that, or could we remove this part of the contract and consider that in this specific case the model have less information?

@surli surli changed the title WiP Fix NPE with union catch inside lambda in noclasspath review: Fix NPE with union catch inside lambda in noclasspath Jun 23, 2017
@monperrus monperrus merged commit c02968f into INRIA:master Jun 23, 2017
surli pushed a commit that referenced this pull request Jul 30, 2018
* refactor: remove commented code

* refactor: remove comment - it is fixed in #1416

* refactor: remove commented code

* fix typo

* restore deleted assertion
spoon-bot added a commit to SpoonLabs/spoon-ci-data that referenced this pull request Jul 30, 2018
* refactor: remove commented code

* refactor: remove comment - it is fixed in INRIA/spoon#1416

* refactor: remove commented code

* fix typo

* restore deleted assertion
spoon-bot added a commit to SpoonLabs/spoon-ci-data that referenced this pull request Jul 30, 2018
* refactor: remove commented code

* refactor: remove comment - it is fixed in INRIA/spoon#1416

* refactor: remove commented code

* fix typo

* restore deleted assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants